package com.neu.admin;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.neu.common.RequiresPermissionsDesc;
import com.neu.common.validator.Order;
import com.neu.common.validator.Sort;
import com.neu.doc.AdminAdController_list;
import com.neu.doc.AdminFeedbackController_list;
import com.neu.domain.ShoppingAd;
import com.neu.domain.ShoppingFeedback;
import com.neu.domain.ShoppingFeedbackExample;
import com.neu.service.ShoppingFeedbackService;
import com.neu.util.ResponseUtil;

import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;

import java.util.List;

/**
 * @author Yogeek
 * @date 2018/8/26 1:11
 */
@Validated
@RequestMapping("/admin/feedback")
@RestController
public class AdminFeedbackController {
	@Autowired
	private ShoppingFeedbackService feedbackService;
    private final Log logger = LogFactory.getLog(AdminFeedbackController.class);
    
    @ApiOperation(value="获取意见(List)分页数据", notes="分页查询意见信息",response = AdminFeedbackController_list.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "page", value = "当前页数", required = true, dataType = "int"),
            @ApiImplicitParam(name = "limit", value = "每页多少条数据", required = true, dataType = "int"),
            @ApiImplicitParam(name = "sort", value = "排序字段", required = true, dataType = "string"),
            @ApiImplicitParam(name = "order", value = "排序规则", required = true, dataType = "string"),
            @ApiImplicitParam(name = "UserName", value = "用户名", required = false, dataType = "string"),
            @ApiImplicitParam(name = "content", value = "意见内容", required = false, dataType = "string")
    })
    @RequiresPermissions("admin:feedback:list")
    @RequiresPermissionsDesc(menu = {"用户管理", "意见反馈"}, button = "查询")
// TODO   
    @GetMapping("/list")
    public Object list(String UserName, String content,
            @RequestParam(defaultValue = "1") Integer page,
            @RequestParam(defaultValue = "10") Integer limit,
            @Sort @RequestParam(defaultValue = "id") String sort,
            @Order @RequestParam(defaultValue = "desc") String order) {
    		List<ShoppingFeedback> adList = feedbackService.querySelective(UserName, content, page, limit, sort, order);
    		return ResponseUtil.okList(adList);
}

}
